<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .container {
        position: relative;
        width: 500px;
        height: 500px;
        border: 1px solid #aaa;
        margin: 0 auto;
      }
      .child {
        width: 150px;
        height: 150px;
        border: 1px solid #000;
        text-align: center;
        position: absolute; 
        /*250px*/
        top: 50%; 
        /*250px */
        left: 50%;
        margin-top: -75px;
        margin-left: -75px;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="child"></div>
    </div>
  </body>
</html>
